<template>
  <tbody>
    <tr v-for="(item, index) in list" :key="item.id">
      <td>{{ index + 1 }}</td>
      <td>{{ item.subject }}</td>
      <td :class="{ red: item.score < 60 }">{{ item.score }}</td>
      <td>{{ newData(item.date) }}</td>
      <td><a href="#" @click="subtract(item.id)">删除</a></td>
    </tr>
    <tr v-show="!list.length">
      <td colspan="5">暂无数据</td>
    </tr>
  </tbody>
</template>

<script>
import moment from "moment";
export default {
  props: {
    list:{
      type:Array,
      require:true
    }
  },
  data() {
    return {};
  },
  methods: {
    subtract(id) {
      this.$emit("subtract", id);
    },
    newData(dt) {
      return moment(dt).format("YYYY-MM-DD HH:mm:ss");
    },
  },
};
</script>

<style>
</style>